{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "executionInfo": {
     "elapsed": 6,
     "status": "ok",
     "timestamp": 1649954376395,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "XSX0v-rJ8YDu",
    "outputId": "e553e987-918f-4741-9198-c98876644680"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "随机生成了一个10臂伯努利老虎机\n",
      "获奖概率最大的拉杆为1号,其获奖概率为0.7203\n"
     ]
    }
   ],
   "source": [
    "# 导入需要使用的库,其中numpy是支持数组和矩阵运算的科学计算库,而matplotlib是绘图库\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "class BernoulliBandit:\n",
    "    \"\"\" 伯努利多臂老虎机,输入K表示拉杆个数 \"\"\"\n",
    "    def __init__(self, K):\n",
    "        self.probs = np.random.uniform(size=K)  # 随机生成K个0～1的数,作为拉动每根拉杆的获奖\n",
    "        # 概率\n",
    "        self.best_idx = np.argmax(self.probs)  # 获奖概率最大的拉杆\n",
    "        self.best_prob = self.probs[self.best_idx]  # 最大的获奖概率\n",
    "        self.K = K\n",
    "\n",
    "    def step(self, k):\n",
    "        # 当玩家选择了k号拉杆后,根据拉动该老虎机的k号拉杆获得奖励的概率返回1（获奖）或0（未\n",
    "        # 获奖）\n",
    "        if np.random.rand() < self.probs[k]:\n",
    "            return 1\n",
    "        else:\n",
    "            return 0\n",
    "\n",
    "\n",
    "np.random.seed(1)  # 设定随机种子,使实验具有可重复性\n",
    "K = 10\n",
    "bandit_10_arm = BernoulliBandit(K)\n",
    "print(\"随机生成了一个%d臂伯努利老虎机\" % K)\n",
    "print(\"获奖概率最大的拉杆为%d号,其获奖概率为%.4f\" %\n",
    "      (bandit_10_arm.best_idx, bandit_10_arm.best_prob))\n",
    "\n",
    "# 随机生成了一个10臂伯努利老虎机\n",
    "# 获奖概率最大的拉杆为1号,其获奖概率为0.7203"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "executionInfo": {
     "elapsed": 3,
     "status": "ok",
     "timestamp": 1649954377232,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "8gqKHavm8YDy"
   },
   "outputs": [],
   "source": [
    "class Solver:\n",
    "    \"\"\" 多臂老虎机算法基本框架 \"\"\"\n",
    "    def __init__(self, bandit):\n",
    "        self.bandit = bandit\n",
    "        self.counts = np.zeros(self.bandit.K)  # 每根拉杆的尝试次数\n",
    "        self.regret = 0.  # 当前步的累积懊悔\n",
    "        self.actions = []  # 维护一个列表,记录每一步的动作\n",
    "        self.regrets = []  # 维护一个列表,记录每一步的累积懊悔\n",
    "\n",
    "    def update_regret(self, k):\n",
    "        # 计算累积懊悔并保存,k为本次动作选择的拉杆的编号\n",
    "        self.regret += self.bandit.best_prob - self.bandit.probs[k]\n",
    "        self.regrets.append(self.regret)\n",
    "\n",
    "    def run_one_step(self):\n",
    "        # 返回当前动作选择哪一根拉杆,由每个具体的策略实现\n",
    "        raise NotImplementedError\n",
    "\n",
    "    def run(self, num_steps):\n",
    "        # 运行一定次数,num_steps为总运行次数\n",
    "        for _ in range(num_steps):\n",
    "            k = self.run_one_step()\n",
    "            self.counts[k] += 1\n",
    "            self.actions.append(k)\n",
    "            self.update_regret(k)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "executionInfo": {
     "elapsed": 2,
     "status": "ok",
     "timestamp": 1649954382967,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "YdD-JGH28YDz"
   },
   "outputs": [],
   "source": [
    "class EpsilonGreedy(Solver):\n",
    "    \"\"\" epsilon贪婪算法,继承Solver类 \"\"\"\n",
    "    def __init__(self, bandit, epsilon=0.01, init_prob=1.0):\n",
    "        super(EpsilonGreedy, self).__init__(bandit)\n",
    "        self.epsilon = epsilon\n",
    "        #初始化拉动所有拉杆的期望奖励估值\n",
    "        self.estimates = np.array([init_prob] * self.bandit.K)\n",
    "\n",
    "    def run_one_step(self):\n",
    "        if np.random.random() < self.epsilon:\n",
    "            k = np.random.randint(0, self.bandit.K)  # 随机选择一根拉杆\n",
    "        else:\n",
    "            k = np.argmax(self.estimates)  # 选择期望奖励估值最大的拉杆\n",
    "        r = self.bandit.step(k)  # 得到本次动作的奖励\n",
    "        self.estimates[k] += 1. / (self.counts[k] + 1) * (r -\n",
    "                                                          self.estimates[k])\n",
    "        return k"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 312
    },
    "executionInfo": {
     "elapsed": 676,
     "status": "ok",
     "timestamp": 1649954384006,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "wIHh_wRA8YDz",
    "outputId": "d5d65ff2-744d-44e2-ec8a-eb78d13397c2"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epsilon-贪婪算法的累积懊悔为： 25.526630933945313\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXxU1f3/8deHkJCwhDUgihDcBaoIKS5Ua7UFWy2WqnWra62t1frVWq3aTfTbX221tlVbK21xqbigFatoK1ZFqvULBhcEUQFFQbbIErZsk/n8/rg3MAlZJpA7k8y8n49HHnPn3Dv3fk4y+cydc889x9wdERHJHp3SHYCIiKSWEr+ISJZR4hcRyTJK/CIiWUaJX0Qkyyjxi4hk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evH3/72N6699lpmzZpFVVUVl156Kd/5zncAuOWWW5g2bRpVVVVMnDiRSZMmAfCLX/yC+++/n7333puioiJGjx7N0qVLOe2003j99WACp8WLF3PGGWcwb968yH/PIu3dtuoYd76whG3Vtc1u99+ln1KQm5OiqCJM/O6+imDiZ9x9s5ktAvaK4liTnlrIOys3tek+h+1ZyM+/OrzZbSoqKhg5cuT259dddx2nn346AIWFhcydO5f777+fK664ghkzZnDjjTfy7LPPstdee7Fx48Zm933ZZZdx7rnnct555zFlyhQuv/xynnjiCQBWrVrFyy+/zLvvvsuECRM49dRTWbhwIaNGjWp2n/PmzePll1+moKCAyZMn07NnT1577TWqqqoYO3Ys48aNY/HixSxevJi5c+fi7kyYMIHZs2fTrVs3Hn74Yd544w1isRijRo1i9OjR7LvvvvTs2ZM333yTkSNHcs8993D++ecn8RsWyXylyzbwx1lL6d6lMzmdmu/kcOyBO42lFpmUfN83s2LgMGAOMBa4zMzOJZig+ip339DIay4GLgYYPHhwKsJsteaaes4888ztj1deeSUAY8eO5fzzz+cb3/gGX//615vd96uvvsrjjwfTxp5zzjlcc80129d97Wtfo1OnTgwbNow1a9Y0+vqJEyeyePFiDjjggO37mTBhAgUFBQDMnDmT+fPn89hjjwFQXl7O4sWLmTlzJjNnzuSwww4DYMuWLSxevJjNmzczceJEunbtun1fdS666CLuuecebrvtNh555BHmzp3bbN1EMk1FdS1Ly7bsVP7u6uCE9LFLjuSgPQpTHVaTIk/8ZtYd+DtwhbtvMrO7gJsADx9/A1zY8HXuPhmYDFBSUtLsxMAtnZmnQ2IXxrrlP/3pT8yZM4enn36akSNHtur6QOL+unTpsn25rhfA8OHDmT179vby6dOnU1paWu/ia7du3eq97o477mD8+PH1jvPss89y3XXXbW/2qfO73/2uyW6Zp5xyCpMmTeK4445j9OjR9O3bN+l6iWSCa/4+n6feWtnk+j5d81IYTcsi7cdvZrkESX+quz8O4O5r3L3W3ePAn4ExUcaQLo888sj2xyOPPBKApUuXcvjhh3PjjTfSr18/li9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md8YuIZBmd8YuIZBklfhGRLKPELyKSZZT4RUSyjBK/iEiW+f9ombY8b5TjXgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def plot_results(solvers, solver_names):\n",
    "    \"\"\"生成累积懊悔随时间变化的图像。输入solvers是一个列表,列表中的每个元素是一种特定的策略。\n",
    "    而solver_names也是一个列表,存储每个策略的名称\"\"\"\n",
    "    for idx, solver in enumerate(solvers):\n",
    "        time_list = range(len(solver.regrets))\n",
    "        plt.plot(time_list, solver.regrets, label=solver_names[idx])\n",
    "    plt.xlabel('Time steps')\n",
    "    plt.ylabel('Cumulative regrets')\n",
    "    plt.title('%d-armed bandit' % solvers[0].bandit.K)\n",
    "    plt.legend()\n",
    "    plt.show()\n",
    "\n",
    "\n",
    "np.random.seed(1)\n",
    "epsilon_greedy_solver = EpsilonGreedy(bandit_10_arm, epsilon=0.01)\n",
    "epsilon_greedy_solver.run(5000)\n",
    "print('epsilon-贪婪算法的累积懊悔为：', epsilon_greedy_solver.regret)\n",
    "plot_results([epsilon_greedy_solver], [\"EpsilonGreedy\"])\n",
    "\n",
    "# epsilon-贪婪算法的累积懊悔为：25.526630933945313"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 295
    },
    "executionInfo": {
     "elapsed": 872,
     "status": "ok",
     "timestamp": 1649954384873,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "hRDFIebd8YD0",
    "outputId": "33430933-becc-41d3-8a85-d46da8f2013c"
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEWCAYAAACXGLsWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHd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H3HKXqn54AsqQD3xKVX8w3vsy5kzYrbPGJBGRfwE6VPVbE7zfMrzfDCyfyP0aM1p2GsqYUxCRDje9SkReF5Ffisg+EXlURD4t3ngSO0Vkics3S0R+LSJb3OvKIba5zK23zY03UA48Cixxaf/h8n3JbWOH9I9VUSYi74vIEy79WRHJdu89KiK7XfqENnZm6rPTUMaM3ofwHtTXjDcWwDpVXSXeIEt/AzwEfAf4T1V9Q0RK8R6nMPjhfn8NfEdVn3aPlvHjjUewXFVXAIjItXiPoFiF94vc9SKyBqgHKoDPqervReRx4ItueiuwVFW19zEgxowV61kYM3pb1BszowfvUQovu/SdQJmb/zjwPffY8PVAXu9zfZL8AfiKiPwTsFBVu4fY17Xu9R7wR2ApXuMBcFBVf+/mf4r3mJM2IAysE5HbgK6zitSYQaxnYczo9STNJ5KWE/R/l3zAFcM0AACo6s9E5G28AXxeEpH78HoqyQT4hqr+eECid21j8IVGVdWYiKwCPob3gL0H8Z7IasyYsJ6FMWPrZbyKGgARWTE4g4gsBmpU9bt4vY8LgXa8oWB7vQR81o3NgYjMd2MZAJSKyBVu/i7gDZdvhqpuwDsddtJ+jTkb1rMwZmz9LfB9EdmB9/3ahHeNItkdwN0iEgWOAP+qqs0i8nsR2QW8qKpfEpFK4A9u8KYO4G6823r3APeKyI/xnjj6Q7xxGp4XkUy8Xsnfj3egZnqxW2eNmUTsFluTKnYayhhjzIisZ2GMMWZE1rMwxhgzImssjDHGjMgaC2OMMSOyxsIYY8yIrLEwxhgzov8HNSchPFkBeoYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "np.random.seed(0)\n",
    "epsilons = [1e-4, 0.01, 0.1, 0.25, 0.5]\n",
    "epsilon_greedy_solver_list = [\n",
    "    EpsilonGreedy(bandit_10_arm, epsilon=e) for e in epsilons\n",
    "]\n",
    "epsilon_greedy_solver_names = [\"epsilon={}\".format(e) for e in epsilons]\n",
    "for solver in epsilon_greedy_solver_list:\n",
    "    solver.run(5000)\n",
    "\n",
    "plot_results(epsilon_greedy_solver_list, epsilon_greedy_solver_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 131
    },
    "executionInfo": {
     "elapsed": 7,
     "status": "error",
     "timestamp": 1649954384874,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "hLIkERHH8YD1",
    "outputId": "0eb1b916-3b0f-4939-83ec-edfad0e79d4e"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epsilon值衰减的贪婪算法的累积懊悔为： 10.114334931260183\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3de7zc073/8dc7O4lELhJJqCI3bRUhaQQlqiokiqYu/SG0Eq1SPWj4VUmPI8Jp64fj1+K0FYQqrVvdShGqOBwnJKRBkwoaxCVJXXIhiew9n/PH9zt7z75kZ7Izlz2z38/HYz9mZs13vt/Pmkw+s2at9V1fRQRmZtZxdCp3AGZmVlpO/GZmHYwTv5lZB+PEb2bWwTjxm5l1ME78ZmYdjBO/WRFIukDSTet5bn9Ji0sUR6NjSXpJ0v6lOLa1X078VjaSTpM0W9JaSTe08PwYSQskfSzpL5IGlSHMqhIRu0TEY9D6l5NVNyd+K6e3gX8HZjR9QlJ/4E7g34AtgdnArYU4qKTOhdiPWaVy4reyiYg7I+Ju4L0Wnj4SeCkibo+INcAFwHBJn29pX5J2kPSopPck/VPSzZL65Dy/SN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FjeOONNwCYNGkSZ5xxBvvssw9Dhw6tj//mm29m7733rk/6AMOGDWPSpElA0kI/+eSTGTt2LCeccEKr7+2ll15aXz516tT68p/85CfsuOOOHHjggfz9738H4NVXX2XkyJH12yxcuJDdd9+91ffHKk8mvdhUp0ps7hdJu206SToZOBlg4MDWr1s97Y8v8be3VxT0+Dt/ujdTv7bLhjfMMXToUDKZDEuXLuWee+5hiy224Nlnn2Xt2rWMHj2asWPHsmDBAu6++25mzZrF5ptvzvvvvw/AkUceyXe/+10AzjvvPK677jpOP/109t9/f+6//34OP/xwbrnlFo466qgW55T379+f5557jl/+8pdcdtllXHvttUybNo0DDjiAKVOm8OCDDzJ9+vT67VevXs2IESPqH0+ZMoVjjjkGgN69e/PMM89w4403MnnyZO677z4uvPBCHnroIbbddls+/PDDVt+H0047jRNOOIGJEycyY8YMzjjjDO6++24A3nnnHZ588kkWLFjA+PHj+cY3vsFLL73UKAG3ZM6cOTz55JN0796d6dOnt/jeLly4kIULF/LMM88QEYwfP54nnniCHj16cMstt/D8889TW1vLyJEj2X333dlhhx3YYostmDt3LiNGjOD666+v/7Kx6pE2+J34c5Q68S+RtE1EvCNpG2Dp+jaMiOnAdIBRo0ZVzPUhs5eynDlzJvPmzatv1S5fvpyFCxfyyCOPcOKJJ7L55psDsOWWWwJJ18Z5553Hhx9+yKpVqxg3bhwAJ510EpdccgmHH344119/Pddcc02Lxz3yyCMB2H333bnzzuRys08++SR33XUXAAcffDB9+/at3761rp4JEybU35555pkAjB49mkmTJnH00UfXH2t9nn766foYvvWtb/GjH/2o/rnDDz+cTp06sfPOO7NkyZIWX3/EEUewcOFCPve5z9XvZ/z48XTv3h1Y/3s7c+ZMZs6cyRe+8AUAVq1axcKFC1m5ciVHHHFE/Xue+8vipJNO4vrrr+fyyy/n1ltv5Zlnnmm1blZ56tLM77zfoNSJ/15gInBxentPIXa6sS3zYnnttdeoqalhq622IiK48sor6xN41oMPPtjiFMFJkyZx9913M3z4cG644QYee+wxIEm4ixYt4vHHH6euro5hw4a1eOzNNksGf2pqaqitrQUavoQ2Vm582fu//vWvmTVrFvfffz8jRozYqPGB3P1l48yNb5ddduGJJ56oL7/rrruYPXt2o8HXHj16NHpdS+/tQw89xJQpUzjllFMalf/85z9f77TMo446qv6X0e67706/fv3yrpdVhnBXTzNF6+OX9HvgaWBHSYslfYck4R8kaSFwUPq4Kixbtozvfe97nHbaaUhi3Lhx/OpXv6rvn3/55Zf56KOPGDt2LDNmzODjjz8GqO/qWblyJdtssw3r1q3j5ptvbrTvE044gQkTJnDiiSduVEz77rsvt912G5C0kj/4IL+Zs7feemv97d577w0k/eF77bUXF154If379+fNN99c7+v32WcfbrnlFiDpv993331bPd5xxx3HU089xb333ltfln1/WrK+93bcuHHMmDGDVatWAfDWW2+xdOlS9ttvP+666y5Wr17NypUr+eMf/1i/r27dujFu3DhOPfXUjX5/rTI0dPWUN472pJizeias56kxxTpmqWX7ybPTOb/1rW9x1llnAUkXwqJFixg5ciQRwYABA7j77rs5+OCDmTt3LqNGjaJr164ccsgh/PSnP+Wiiy5ir732YtCgQey6666sXLmy/jjHH3885513Xn0XTL6mTp3KhAkTuPXWW/nyl7/MNttsQ69evRrFnnXwwQdz8cXJ9/DatWvZa6+9yGQy/P73vwfg7LPPZuHChUQEY8aMYfjw4Tz++OMtHveKK67g29/+NpdeeikDBgzg+uuvbzXO7t27c99993HWWWcxefJktt56a3r16sV5553X4vbre2/Hjh3L/Pnz67+sevbsyU033cTIkSM55phjGDFiBIMGDeJLX/pSo/0df/zx3HnnnYwdOzaPd9UqTXZwt8aZv57a2h1QSqNGjYqmF2KZP38+O+20U5kiKq077riDe+65h9/+9rcb9bq1a9dSU1ND586defrppzn11FM32EWTvehN//79NyXkinLZZZexfPlyLrroohaf70iftWp0+cMvc8WfF7Lo4kPLHUrJSZoTEc3mXLfbWT2WOP3003nggQf405/+tNGvfeONNzj66KPJZDJ07dp1vQPDHdkRRxzBq6++yqOPPlruUKxIIsLdPE048bdzV155ZZtf+9n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ll6bbnZ3uY54a1tofLGmBpN+k5XdI2jx97mJJf0vLS/rFZdXNXT3WkQ0nWQTtfZK1zK+NiD2VXPTldGAy8Avg/0fEk5IGkpwS33ThtO8Bv4iIm9PlQWpI1lMfFhEjACSNJVlGYE+SMzHvlbQf8AawI/CdiHhK0gzg++ntEcDnIyKySzmYFYJb/NaRPRvJuv9rSU6Hn5mWvwAMTu8fCFyVLpV8L9A7u85KjqeBH0s6BxgUEatbONbY9O954Dng8yRfBABvRsRT6f2bSJarWAGsAa6VdCTw8SbV1CyHW/zWka3NuZ/JeZyh4f9GJ2Dv9SRzACLid5JmkVxM5CFJJ5H8gsgl4GcRcXWjwmQsoOlAW0REraQ9gTEki5edRrJypdkmc4vfrHUzSZIuAJJGNN1A0lDgtYi4guRXwW7ASpJLRmY9BHw7vb4AkrZN12IHGChp7/T+BODJdLstIuJPJF1OzY5r1lZu8Zu17gzgPyXNI/n/8gRJn36uY4BvSloHvAtcGBHvS3pK0ovAAxFxtqSdgKfTi8msAr5JMtV0PjBR0tUkKzP+imSd+XskdSP5tXBmsStqHYenc5qVkad9Wjm4q8fMrINxi9/MrINxi9/MrINx4jcz62Cc+M3MOhgnfjOzDsaJ38ysg/lftXLG7RzTrx8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "class DecayingEpsilonGreedy(Solver):\n",
    "    \"\"\" epsilon值随时间衰减的epsilon-贪婪算法,继承Solver类 \"\"\"\n",
    "    def __init__(self, bandit, init_prob=1.0):\n",
    "        super(DecayingEpsilonGreedy, self).__init__(bandit)\n",
    "        self.estimates = np.array([init_prob] * self.bandit.K)\n",
    "        self.total_count = 0\n",
    "\n",
    "    def run_one_step(self):\n",
    "        self.total_count += 1\n",
    "        if np.random.random() < 1 / self.total_count:  # epsilon值随时间衰减\n",
    "            k = np.random.randint(0, self.bandit.K)\n",
    "        else:\n",
    "            k = np.argmax(self.estimates)\n",
    "\n",
    "        r = self.bandit.step(k)\n",
    "        self.estimates[k] += 1. / (self.counts[k] + 1) * (r -\n",
    "                                                          self.estimates[k])\n",
    "\n",
    "        return k\n",
    "\n",
    "\n",
    "np.random.seed(1)\n",
    "decaying_epsilon_greedy_solver = DecayingEpsilonGreedy(bandit_10_arm)\n",
    "decaying_epsilon_greedy_solver.run(5000)\n",
    "print('epsilon值衰减的贪婪算法的累积懊悔为：', decaying_epsilon_greedy_solver.regret)\n",
    "plot_results([decaying_epsilon_greedy_solver], [\"DecayingEpsilonGreedy\"])\n",
    "\n",
    "# epsilon值衰减的贪婪算法的累积懊悔为：10.114334931260183"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 131
    },
    "executionInfo": {
     "elapsed": 461,
     "status": "error",
     "timestamp": 1649954385672,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "O8XF2JjA8YD1",
    "outputId": "1a6b1248-c5c2-40cd-d3e7-5bea8e16e4e9"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "上置信界算法的累积懊悔为： 70.45281214197854\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deZxcVZn/8c83SSedrbMDISEkRAzbj7VBBZVARFBR3EVQw4jGQUZhXEFnBGZRnGFUnHHEqGhQEBBFcFQkBFARjSSyg0AIAZqErJ10et+e3x/3dlI0ne5Kp2v/vl+vetWtU7fufU7S/fSpc889RxGBmZlVjmGFDsDMzPLLid/M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ammVwi98qWVvGdnfG6252/m4MA16zi2QOQERcJ2k5yWIiv5X0EZJvEJkEfCUivvOSwuRaQO8LbRERnZKOAxaQTF72DyQzV5rtMbf4zfp3O0nSBUDSkb13kHQAsDoivknyreBwYDvJkpE9fgt8OF1fAEkz0rnYAWZJek26/X7gnnS/CRHxa5Iup5ed12yw3OI3698ngW9Jeojk9+X3JH36md4HfEBSB/Ai8C8RsUXSHyU9AvwmIj4r6WDgT+liMo3AB0iGmj4OLJT0HZKZGb9NMs/8LZKqSb4t/GOuK2qVw8M5zQrIwz6tENzVY2ZWYdziNzOrMG7xm5lVGCd+M7MK48RvZlZhnPjNzCqME7+ZWYX5//LTyk90GrluAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "class UCB(Solver):\n",
    "    \"\"\" UCB算法,继承Solver类 \"\"\"\n",
    "    def __init__(self, bandit, coef, init_prob=1.0):\n",
    "        super(UCB, self).__init__(bandit)\n",
    "        self.total_count = 0\n",
    "        self.estimates = np.array([init_prob] * self.bandit.K)\n",
    "        self.coef = coef\n",
    "\n",
    "    def run_one_step(self):\n",
    "        self.total_count += 1\n",
    "        ucb = self.estimates + self.coef * np.sqrt(\n",
    "            np.log(self.total_count) / (2 * (self.counts + 1)))  # 计算上置信界\n",
    "        k = np.argmax(ucb)  # 选出上置信界最大的拉杆\n",
    "        r = self.bandit.step(k)\n",
    "        self.estimates[k] += 1. / (self.counts[k] + 1) * (r -\n",
    "                                                          self.estimates[k])\n",
    "        return k\n",
    "\n",
    "\n",
    "np.random.seed(1)\n",
    "coef = 1  # 控制不确定性比重的系数\n",
    "UCB_solver = UCB(bandit_10_arm, coef)\n",
    "UCB_solver.run(5000)\n",
    "print('上置信界算法的累积懊悔为：', UCB_solver.regret)\n",
    "plot_results([UCB_solver], [\"UCB\"])\n",
    "\n",
    "# 上置信界算法的累积懊悔为： 70.45281214197854"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 312
    },
    "executionInfo": {
     "elapsed": 553,
     "status": "ok",
     "timestamp": 1649954387265,
     "user": {
      "displayName": "Sam Lu",
      "userId": "15789059763790170725"
     },
     "user_tz": -480
    },
    "id": "K32HquQ-8YD2",
    "outputId": "b4c0d5cc-961d-4f25-a1db-22b6e12e82eb"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "汤普森采样算法的累积懊悔为： 57.19161964443925\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXxU1f3/8dcnCRAgCfu+gyiLVVBEEVQUF1wqWnGtikVFbdWqv7r2W6ut/WpbWytWvxXrgivgVqlLKxVRUcomyI4gRNn3JYHs+fz+uDcxQkgmmMkkM+/n45HH3Dlzl8+Bmc+cOffec8zdERGRxJEU6wBERKRmKfGLiCQYJX4RkQSjxC8ikmCU+EVEEowSv4hIglHiF4kCM7vPzF48wGtDzWxtDcXxnWOZ2WIzG1oTx5baS4lfYsbMbjSzOWaWZ2bPlfP6MDNbZmZ7zexDM+sSgzDjirv3dfdpUPGXk8Q3JX6JpfXAA8Az+75gZi2BN4BfAc2BOcDE6jiomaVUx35E6iolfokZd3/D3f8BbCvn5R8Bi939VXfPBe4DjjSzXuXty8x6mNlUM9tmZlvN7CUza1rm9Uwzu9PMFgB7zCwlLLvdzBaY2R4ze9rM2pjZe2aWZWb/MbNmZfZxnJl9ZmY7zeyLsl0mZtbNzD4Kt5sCtKys/mZ2Txhrppn9uEz52WY2z8x2m9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DmS+++/Hwha7JdddhkffvghBQUFjBs3jrvvvpuVK1dy++23c/311zNt2jTuvfdeWrRowfLlyznxxBN54oknSo9TIi0tjezsbKZNm8Z9991Hy5YtWbRoEUcffTQvvvgiZsa7777LbbfdRsuWLTnqqKNYtWoVb7/9ds39x4pU0cxV2/joyy37lc9bs4MjOjbhiR8fVe52Zkb7JqlRiysuEv/9/1zMkvW7q3Wffdpn8Osf9q18xXKsWLGCV155haeeeoqLLrqI119/ncsvv5wrr7ySxx57jJNOOol7772X+++/n7/85S8A1K9fn48//phHH32UESNGMHfuXJo3b06PHj249dZbAVi+fDlPP/00gwcPZvTo0TzxxBOMHj2aN998k2XLlmFm7Ny5E4Abb7yRK6+8klGjRvHMM89w8803849//AOADRs2MH36dJYtW8a5557LyJEjueiiixgyZAiffPIJw4YN4/LLL6d///4A/O53v6N58+YUFRUxbNgwFixYwBFHHAFAp06dmDFjBrfeeitXXXUVn376Kbm5ufTt25frr78egFmzZrFkyRK6dOnC8OHDeeONNxg5cuQB//3mzZvH4sWLad++PYMHD+bTTz9lwIABXHfddXz88cd069aNSy+99KD+b6Rum7lqG3O/2RHrMCL28sxvWLsjh3rJ+194MLxvWzo2axSDqOIk8dc23bp1o1+/fgAcffTRZGZmsmvXLnbu3MlJJ50EwKhRo7jwwm9vWj733HMB+MEPfkDfvn1p164dAN27d2fNmjU0bdqUTp06MXjwYAAuv/xyxo4dyy233EJqairXXHMNZ599dmk304wZM3jjjWDa2SuuuII77rij9FjnnXceSUlJ9OnTh02bNgFBC3/58uVMnTqVqVOnMmzYMF599VWGDRvGpEmTGDduHIWFhWzYsIElS5aUJv6ycWdnZ5Oenk56ejqpqamlX0IDBw6ke/fuAFx66aVMnz69wsQ/cODA0l8c/fr1IzMzk7S0NLp37156zuHSSy9l3LhxB/G/I7VBUfHBDQ5595sLWbVlTzVHE103D+vJbadFp8vmYMVF4j/Ylnm0NGjw7YmY5ORkcnJyIt4mKSnpO9snJSVRWFgI7H+5opmRkpLCrFmz+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5n9CNj7vWoqUoZa/JLI8sosF5d5Xsy3n40kYNABkjkA7v6ymc0kmEzk32Z2DcEviLIMeNDdn/xOYXAuYN8Tbe7uhWY2EBhGMHjZjQQjV4p8b2rxi1TsfYKkC4CZ9dt3BTPrDqxy97EEvwqOALIIpows8W9gdDi/AGbWIRyLHaCzmQ0Kly8FpofrNXH3dwm6nPY7rsjBUotfpGI3A4+b2QKCz8vHBH36ZV0MXG5mBcBG4Dfuvt3MPjWzRcB77n67mfUGZoSTyWQDlxNcaroUGGVmTxKMzPh/BOPMv2VmqQS/Fm6NdkUlcehyTpEY0mWfEgvq6hERSTBq8YuIJBi1+EVEEowSv4hIglHiFxFJMEr8IiIJRolfRCTB/H+B7nOb7YMbrQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "class ThompsonSampling(Solver):\n",
    "    \"\"\" 汤普森采样算法,继承Solver类 \"\"\"\n",
    "    def __init__(self, bandit):\n",
    "        super(ThompsonSampling, self).__init__(bandit)\n",
    "        self._a = np.ones(self.bandit.K)  # 列表,表示每根拉杆奖励为1的次数\n",
    "        self._b = np.ones(self.bandit.K)  # 列表,表示每根拉杆奖励为0的次数\n",
    "\n",
    "    def run_one_step(self):\n",
    "        samples = np.random.beta(self._a, self._b)  # 按照Beta分布采样一组奖励样本\n",
    "        k = np.argmax(samples)  # 选出采样奖励最大的拉杆\n",
    "        r = self.bandit.step(k)\n",
    "\n",
    "        self._a[k] += r  # 更新Beta分布的第一个参数\n",
    "        self._b[k] += (1 - r)  # 更新Beta分布的第二个参数\n",
    "        return k\n",
    "\n",
    "\n",
    "np.random.seed(1)\n",
    "thompson_sampling_solver = ThompsonSampling(bandit_10_arm)\n",
    "thompson_sampling_solver.run(5000)\n",
    "print('汤普森采样算法的累积懊悔为：', thompson_sampling_solver.regret)\n",
    "plot_results([thompson_sampling_solver], [\"ThompsonSampling\"])\n",
    "\n",
    "# 汤普森采样算法的累积懊悔为：57.19161964443925"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "collapsed_sections": [],
   "name": "第2章-多臂老虎机问题.ipynb",
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
